package com.octo.poker;

import org.springframework.stereotype.Service;

import com.octo.poker.data.Hand;

@Service 
public class PokerComparator {

	/**
	 * If your poker hand is better than his, this method returns 1.
	 *
	 * If his hand is better, this method returns -1.
	 *
	 * If both hand are equals, this method returns 0.
	 */
	public int compare(Hand yours, Hand his) {
		int yourLevel = yours.getBestLevel();
		int hisLevel = his.getBestLevel();
		if(yourLevel > hisLevel)	return 1;
		if(hisLevel > yourLevel)	return -1;
		return 0;
	}
}
